import { Button, Col, DatePicker, Form, Row } from "antd"
import useIntentModel from "../../../model/useIntentModel"
import { formatDateValue } from "../../../utils"
import { useGetUiState } from "../helper/init"

const IdCardExpirationDateCell = () => {

    const { entryInfo, updateCustomerInfo } = useIntentModel()
    const { isViewMode, isPreSecondSignMode } = useGetUiState()
    const customer = entryInfo?.customer || {}
    const { idCardExpirationDate } = customer

    return <Row>
        <Col span={16}>
            <Form.Item>
                <DatePicker
                    disabled={isViewMode || isPreSecondSignMode}
                    format="YYYY-MM-DD"
                    onChange={(val) => { updateCustomerInfo({ idCardExpirationDate: val }) }}
                    value={formatDateValue(idCardExpirationDate)}
                    showToday={false}
                    placeholder="请选择" />
            </Form.Item>
        </Col>
        <Col span={4}>
            <Button
                children="长期"
                disabled={isViewMode || isPreSecondSignMode}
                onClick={() => { updateCustomerInfo({ idCardExpirationDate: '2099-12-31' }) }} />
        </Col>
    </Row>


}

export default IdCardExpirationDateCell